
<?php
 if(!$_POST)
 {
 echo '
 <head>
	<title>考核作业</title>
	<meta charset="utf-8">

</head>
<body >
<div style="background-image: url(天空.gif);background-repeat: no-repeat;background-size: 100% 100%;height: 400px">
<p style="text-align: center;font-size: 20px">这是一个你敢不做就会被开除的考核作业(轩总牛逼轩总牛逼轩总牛逼！x
 n)</p>
 <br>
<form action="kaohe.php" method="post" style="text-align: center; color: white">
请输入你的用户名啦<input type="text" name="id"><br>
请输入你的密码啦 &nbsp&nbsp&nbsp<input type="text" name="password"><br>
<br>
<br>
<input type="submit" value="掏一下就可以提交了" style="background-color:rgba(0,0,0,0.5);border:0px;font-weight:700;color: white;cursor: pointer;border-radius: 5%;">
</form>
</div>
</body>';
}
if($_POST) 
{
$con=mysqli_connect("localhost","root","","user");
if (mysqli_connect_errno())
{
    echo "连接失败: " . mysqli_connect_error();
}
$ID = $_POST["id"];
$PASSWORD =(string)($_POST["password"]);
$password1 = $PASSWORD;
for($i = 0;$i<(int)(strlen($PASSWORD));$i++)
{
	$password1[$i] = $PASSWORD[(strlen($PASSWORD))-$i-1];
}
 class Users
	{
		public $id;
		public $password;
		public $information;
		public $age;
		function __construct($a,$b) //获取账号密码的...
		{
			$this->id = $a;
			$this->password = $b;
			$this->information = "NULL";
		}
		public function show_information() //展示信息的
		{
			echo "此账户的信息是："."$information"."<br>";
			echo "此账户的年龄是："."$age"."<br>";
		}
		public function check() //检测用户信息的
		{
			$con=mysqli_connect("localhost","root","","user");
			$result = mysqli_query($con,"SELECT * FROM user
			WHERE  id ='123'");
			while($row = mysqli_fetch_array($result))
			{
				$con=mysqli_connect("localhost","root","","user");
			$result = mysqli_query($con,"SELECT * FROM user
				WHERE password = '$this->password'");
				while($row = mysqli_fetch_array($result))
				{
					$con=mysqli_connect("localhost","root","","user");
					$this->information = $row['information'];
					$this->age = $row['age'];
				}
			}
		}
	}
	$newuser = new Users($ID,$password1);
	$newuser->check();
	if($newuser->information != "NULL")
	{
		echo "恭喜你登陆成功辣~~~~~~~~~~~~~~~~~~~~"."<br>";
		echo "用户信息为:"."$newuser->information"."<br>";
		echo"用户年龄为:"."$newuser->age";
	}
}
?>